<template>
  <header class="header">
    <h1>todos</h1>
    <input class="new-todo" v-model="msg" placeholder="你想做什么" @keyup.enter="myadd" v-focus />
  </header>
</template>

<script>
import { mapMutations } from 'vuex'
export default {
  name: 'TodoHeader',
  data () {
    return {
      msg: ''
    }
  },
  methods: {
    ...mapMutations(['add']),
    myadd (val) {
      this.add(this.msg)
      this.msg = ''
    }
  },
  computed: {

  }
}
</script>

<style scoped lang="less">
</style>
